#include "qselfitem.h"

QSelfItem::QSelfItem(QStringList header,QStringList values)
	: QBDDItem(header,values)
{
	#ifdef	LOG_ACTIVATED
	__TRACE__
	#endif
	#ifdef	LEAK_ACTIVATED
	__LEAK__
	#endif
	m_type = PART_SELF;
	m_bddFile = DB_SELF_FILE;

	if(header.contains(LA_DESC))
	{
		QString desc = values[header.indexOf(LA_DESC)];
		m_properties[PART_PACKAGE]		= extractFrom(desc,RE_PACKAGE);
		m_properties[PART_CURRENT]		= extractFrom(desc,RE_CURRENT);
		m_properties[PART_TOLERANCE]	= extractFrom(desc,RE_TOLERANCE);
		m_properties[PART_SELF_VALUE]	= QNormalize::units(RE_GENERAL_LOW_VALUE,extractFrom(desc,RE_SELF_VALUE),PART_SELF_UNIT);
	}
	else
		m_properties[PART_PACKAGE] = m_properties[PART_CURRENT] = m_properties[PART_TOLERANCE] = m_properties[PART_SELF_VALUE] =PART_UNKNOWN;
}


QSelfItem::QSelfItem(QByteArray in)
	: QBDDItem(in)
{
	#ifdef	LOG_ACTIVATED
	__TRACE__
	#endif
	#ifdef	LEAK_ACTIVATED
	__LEAK__
	#endif
	m_type = PART_SELF;
   m_bddFile = DB_SELF_FILE;
}

QSelfItem::~QSelfItem()
{
	#ifdef	LOG_ACTIVATED
	__TRACE__
	#endif
	#ifdef	LEAK_ACTIVATED
	__LEAK__
	#endif
}


QStringList QSelfItem::cat_1() 
{ 
	#ifdef	LOG_ACTIVATED
	__TRACE__
	#endif
	#ifdef	LEAK_ACTIVATED
	__LEAK__
	#endif
	QStringList list;
	list << LA_SELF_TYPE_1; 
	return list; 
}

QStringList QSelfItem::cat_2()
{ 
	#ifdef	LOG_ACTIVATED
	__TRACE__
	#endif
	#ifdef	LEAK_ACTIVATED
	__LEAK__
	#endif
	QStringList list;
	list << LA_SELF_TYPE_2; 
	list << LA_SELF_ALT_TYPE_2;
	return list; 
}